package com.hly.musicbackground.model.movies.rest;

import com.hly.musicbackground.Utils.RequestContextUtils;
import com.hly.musicbackground.model.movies.VO.MoviesDetailVO;
import com.hly.musicbackground.model.movies.service.MoviesService;
import com.hly.musicbackground.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 影视
 * */
@RestController
@RequestMapping("/api/movies")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Api(tags = "影视")
public class MoviesController {

    private final MoviesService moviesService;

    @GetMapping("/detail/{id}")
    @ApiOperation(value = "获取影视详情")
    public Result<MoviesDetailVO> getDetail(@PathVariable("id") int id){
        int uid = RequestContextUtils.getUser().getUserId();
        return Result.ok(moviesService.getDetail(id, uid));
    }
}
